package spec.lijunyao.unit5.collection;




import spec.lijunyao.unit3.clzz.simple.Student;

import java.net.SocketPermission;
import java.util.ArrayList;
import java.util.Collection;

public class CollectionTest {
    public static void main(String[] args) {
       Object o= new ArrayList();
       Collection c=new ArrayList();
        Student s1=new Student("张三","计信一班","计信");
        Student s2=new Student("李四","计信一班","计信");
        Student s3=new Student("王五","计信一班","计信");
       System.out.println(c.isEmpty());
        System.out.println(c.size());

        ArrayList a=new ArrayList();
        if(a==c){
            System.out.println("a和c相等");
        }
       /*if(a==c);
        {
            System.out.println("a和c相对等");
        }
     */
       //Ctrl+鼠标左键单击  size
        //a.size(ArrayList)
        //c.size(Collection)
       a.size();
       c.size();
       a.listIterator();
       // c.listIterator();不可用
       //a是ArrayList类型 c是Collection类型，都指向ArrayList对象
       //a和虽然都是ArrarList对象,但数据类型不同
        // 这就决定了它们能调用的范围不同
        //c只能调用Collection接口的方法
        // a既可以调用Collection接口定义的方法，也可以调用ArrayList定义的方法
        //因为ArrayList 是 Collecion上午子类




        c.add(s1);
        System.out.println(c.size());
        System.out.println(c.isEmpty());

        c.add(s2);
        System.out.println(c.size());


        c.add(s3);
        System.out.println(c.size());

           }

}
